package VWorldGameStudio;

import Function.FCMutilPlayPropulsionCache;
import lombok.Getter;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.concurrent.CopyOnWriteArrayList;

import static FCRendering.FCRMaster.*;
import static FCRendering.FCRMaster.fcv;

/**
 * 触发剧情的几大类形，事件完成组合，队伍里有什么人，人物状态（血量，等级，金钱，在什么地图，或具体的什么位置，拥有什么物品，拥有什么坦克）的组合
 *已经触发了什么剧情组合,打了什么boss组合
 *例如
 *new save剧情是触发条件是
 *     {"level"=0,"mapName"="home2"}
 *红狼相遇对话剧情是
 * {"bossHasKill"=["fightdog"]} 其他参数默认就不判断
 *
 * {"noTouchOff"=1}
 */
public class FCPlotTouchOffEntity implements Serializable {

    @Getter
    private int noTouchOff = -1;//1的时候表示不自动触发

    @Getter
    private int level = -1;

    @Getter
    private int blood = -1;
    @Getter
    private int money = -1;
    @Getter
    private String mapName = null;
    @Getter
    private int mapX = -1;
    @Getter
    private int mapY = -1;

    @Getter
    private ArrayList<Integer> mapxs = null;
    @Getter
    private ArrayList<Integer> mapys = null;
    @Getter
    private ArrayList<String> hasItems = null;
    @Getter
    private String drivingTank = null;
    @Getter
    private ArrayList<String> npcWhoInTeam = null;
    @Getter
    private ArrayList<String> eventHasHappens = null;
    @Getter
    private ArrayList<String> plotHasHappens = null;
    @Getter
    private ArrayList<String> monsterHasKill = null;

    @Getter
    private String touZiActionName = null;//投资项目

    @Getter
    private int touZiMoney = 0;//投资金钱大于这个数

    @Getter //表示结束这个对话后执行剧情
    private String endSayEventId = null;
    @Getter
    private int endSayNum = -1;

    @Getter
    private int triggerCmd = -1;

    //TODO 举个例子，比如A剧情要一个参数B成立才不会触发，那B参数需要B剧情来写入，就需要下面这个了
    @Getter //例子是 touchOffKey="AplotKey:1"  表示满足FCSave的plotTouchOffKeyMaps里存在AplotKey值为1的时候，触发,不存在都默认是-1
    private String touchOffKey = null;

    public static boolean isTriggetCmdFix(int cmd){
        switch (cmd){
            case 100:
            //检查本地图有没属于自己的坦克
                CopyOnWriteArrayList<FCPropulsion> fcPropulsions = FCMutilPlayPropulsionCache.mapToPropulsionMap.get(player1.getMapname());
                if (fcPropulsions != null) {
                    for (FCPropulsion propulsion : fcPropulsions) {
                        if (propulsion.getVisable() == 1 && propulsion.getPropulsionType().equals("tank")
                        &&propulsion.getPropulsionHostId().equals(gameSave.HOST_UID)){
                            if(((FCTank)propulsion).getType().equals("owner")){
                                return true;
                            }
                        }
                    }
                }
                return false;
        }
        return false;
    }
}
